Repository navigation
Conversation
_parse_file_path split on the last colon, so entry.py:pkg_srv:app became file entry.py:pkg_srv and failed with File not found, making the module:object branch of _import_server unreachable from the CLI. Split on the first colon after the file path whose left side is an existing file, falling back to the last-colon split so missing files report the same path as before. Fixes modelcontextprotocol#3966
2 tasks done
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
Re-trigger cubic
…path If the whole file spec is an existing file, take it as-is instead of splitting on its colons: a colon can be part of the file path itself. Also skip the colon-in-directory tests on Windows, where ':' is not allowed in directory names.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3966.
_parse_file_path()split the file spec on the last colon, soentry.py:pkg_srv:appbecame fileentry.py:pkg_srvand failed withFile not found— making themodule:objectbranch of_import_server()unreachable from the CLI (mcp dev/run/install).This splits on the first colon after the file path whose left side is an existing file, so the server object may itself contain a colon. A colon can also appear inside the file path, so each candidate split is checked for an existing file; when no split leaves an existing file it falls back to the last-colon split, so a genuinely missing file reports the same path as before.
Tests: added a
entry.py:pkg_srv:appcase totest_parse_file_path_accepts_valid_specs, plus a colon-in-directory case and a missing-file-with-module:objectcase.tests/cli/test_utils.py: 13 passed;src/mcp/cli/cli.pycoverage 100%,ruffandpyrightclean.